package com.uenpay.im.ui.old.activity.mycollect;

import com.qiyunxin.android.http.net.HttpInvokeItem;
import com.uenpay.im.configuration.APIConfiguration;

import org.json.JSONException;
import org.json.JSONObject;

public class DeleteCollectInvokeItem extends HttpInvokeItem {

	public class DeleteCollectInvokeItemResult {
		public int status = -1;
		public String msg;
	}

	public DeleteCollectInvokeItemResult getOutput() {
		return (DeleteCollectInvokeItemResult) GetResultObject();
	}

	public DeleteCollectInvokeItem(int favorite_id) {
		String url = APIConfiguration.getBaseUrl()
				+ "Favorite/Favorite/deleteFavorite?favoriteid="
				+ favorite_id+ "&"
				+ APIConfiguration.getCustIdAndToken();
		SetUrl(url);
	}

	@Override
	protected Object DeserializeResult(String responseBody) throws Exception {
		DeleteCollectInvokeItemResult result = new DeleteCollectInvokeItemResult();
		try {
			JSONObject json = new JSONObject(responseBody);
			result.status = json.optInt("status");
			result.msg = json.optString("msg");
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return result;
	}
}
